Skip to content

[RHDHBUGS-3010]: Fix GitHub publication workflow#2100

Merged
themr0c merged 20 commits into
redhat-developer:mainfrom
themr0c:fix/gh-pages-workflow
Apr 27, 2026
Merged

[RHDHBUGS-3010]: Fix GitHub publication workflow#2100
themr0c merged 20 commits into
redhat-developer:mainfrom
themr0c:fix/gh-pages-workflow

Conversation

@themr0c

@themr0c themr0c commented Apr 24, 2026

Copy link
Copy Markdown
Member

IMPORTANT: Do Not Merge - To be merged by Docs Team Only

Version(s): All (main, release-1.9+)
Issue: https://redhat.atlassian.net/browse/RHDHBUGS-3010
Preview: N/A (workflow and build script changes)

Summary

  • Fix CQA-14 recursion that destroys PR builds by overwriting main/ on gh-pages (preliminary report + CQA_RUNNING guard)
  • Rewrite deploy-gh-pages.sh as Node.js (deploy-gh-pages.js) with integrated cleanup of merged/closed PRs and deleted branches, index regeneration with release notes links, and rebase retry on push conflicts
  • Remove unused scripts: build.sh, build-cqa.sh, lint-scripts.sh
  • Remove redundant CQA directory copy in pr.yml
  • Update build-asciidoc.yml to use single deploy step (replaces deploy + inline cleanup)
  • Add architecture documentation (docs/github-publication-workflow.md)
  • Update README.adoc: accurate Jira URLs, prerequisites, release notes info, .Prerequisites/.Procedure structure

Test plan

  • Verify PR build deploys to pr-N/ (not main/) on gh-pages
  • Verify main branch build deploys to main/ with cleanup and index regeneration
  • Verify release branch build deploys correctly
  • Verify CQA-14 standalone run does not destroy PR builds
  • Verify concurrent push retry works (rebase + rebuild)

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

themr0c and others added 8 commits April 24, 2026 14:48
…ode.js

- Fix CQA-14 recursion: write preliminary build-report.json before CQA
  so CQA-14 reads lychee results without triggering a full rebuild that
  wipes PR build output and overwrites main on gh-pages
- Remove stale CDN index fetch (fetchUrl, updateRootIndex) from orchestrator
- Rewrite deploy-gh-pages.sh as deploy-gh-pages.js with integrated cleanup
  (stale PR dirs via GitHub API, deleted branches via git ls-remote),
  index regeneration with release notes links, and rebase retry
- Consolidate deploy + cleanup into single gh-pages commit
- Add lychee exclusion for VPN-only release notes URL
- Add architecture documentation for the publication workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The rsync on line 148 already copies the entire build/scripts directory
including cqa/. The subsequent rm + cp of the same cqa/ directory was
a leftover from before rsync was used.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Legacy utility script with no references from any workflow, script,
or documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
build-cqa.sh: thin wrapper for node cqa/index.js --all, never
referenced by any workflow or script.

lint-scripts.sh: local shellcheck runner superseded by the
shellcheck.yml workflow using reviewdog.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cleanup of merged PRs and deleted branches is now part of the deploy
step (deploy-gh-pages.js), not a separate workflow step.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Quick reference for each script, CQA usage, and workflow mappings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove reference to deleted build/scripts/build.sh asciidoctor
alternative. Update deploy script reference from .sh to .js.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix prerequisites: Node.js + Podman (not asciidoctor)
- Note that build includes lychee and CQA automatically
- Fix lychee section: clarify manual vs automatic, remove false claim
  that orchestrator downloads lychee
- Fix [code,terminal] to [source,terminal]
- Fix missing link: prefix on RHDHPAI URL
- Add link to architecture documentation
- Remove redundant ccutil preference note

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rhdh-bot

rhdh-bot commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

Shellcheck Analysis Results

Changed shell scripts in this PR: 1

Scripts analyzed:

  • build/scripts/deploy-gh-pages.sh

Check the Files changed tab for detailed shellcheck suggestions.

All findings are reported as warnings and won't block the PR.


Automated shellcheck analysis • See shellcheck.net for details

@rhdh-bot

rhdh-bot commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

PR Build Results

Build failed -- 34/34 titles | 127s
Preview: https://redhat-developer.github.io/red-hat-developers-documentation-rhdh/pr-2100/

View full logs


Content Quality Assessment

CQA Report

  • CQA-00a: Orphaned modules
  • CQA-00b: Directory structure
  • CQA-01: Vale AsciiDoc DITA compliance
  • CQA-02: Verify assembly structure
  • CQA-03: Verify content type metadata
  • CQA-04: Verify module templates
  • CQA-05: Verify required modular elements
  • CQA-06: Verify assemblies follow official template (one user story)
  • CQA-07: Verify TOC depth (max 3 levels)
  • CQA-08: Verify short description content quality
  • CQA-09: Verify short description format
  • CQA-10: Verify titles are brief, complete, and descriptive
  • CQA-11: Verify procedure prerequisites
  • CQA-12: Verify grammar and style (Vale)
  • CQA-13: Verify content matches declared type
  • CQA-14: Verify no broken links
  • CQA-15: Check redirects
  • CQA-16: Verify official product names
  • CQA-17: Verify legal disclaimers for preview features

Summary

Checks: 19 total, 19 pass, 0 fail

19 checks: 19 pass, 0 fail

Run node build/scripts/cqa/index.js --all --fix locally to review and auto-fix issues.


Updated 2026-04-24 15:34:10 UTC

Shellcheck: filter out deleted .sh files before running shellcheck,
preventing reviewdog parse error on empty input.

SonarCloud: use http.extraHeader for git auth instead of embedding
token in remote URL, avoiding security hotspot.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread build/scripts/deploy-gh-pages.js Outdated
Comment thread build/scripts/deploy-gh-pages.js Outdated

// ── Content application ──────────────────────────────────────────────────────

function applyContent(deployDir, publishDir, branchDir) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this wrapper achieve? why not call cpSync directly in the 2 places where this function lives?

Comment thread build/scripts/deploy-gh-pages.js Outdated

// Branch cleanup: remove directories for deleted remote branches
const branchDirs = readdirSync(deployDir).filter(d =>
!d.startsWith('pr-') && !d.startsWith('.') && statSync(join(deployDir, d)).isDirectory()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would we add other patterns here, like rhdh-* and 1.* branches which are EOL?

Or do we just delete branches manually from https://github.com/redhat-developer/red-hat-developers-documentation-rhdh/branches/stale so that they're not recreated?

- Replace node:https callback API with fetch() (Node 18+)
- Remove unused branchDir parameter from applyContent()
- Extract cleanup from stageAndCommit into pushWithRetry (runs once, not per retry)
- Deduplicate readdirSync call for diagnostics
- Add flow overview and inline comments for non-obvious decisions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@nickboldt nickboldt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving to .js for "easier maintainability and testing" is kinda funny when you have to replace cp with a method called cpsync and haven't added actual tests...

but sure.

/lgtm

themr0c and others added 2 commits April 24, 2026 17:13
The Node.js rewrite was 325 lines for functionality that fits naturally
in ~289 lines of bash. The deploy script's core job is git operations
(fetch, copy, add, commit, push) which read more naturally in shell.

Changes from the original 88-line script:
- Rebase-based retry replaces sleep-based retry (instant vs 2+ minutes)
- Cleanup of stale PR/branch dirs integrated (was separate workflow step)
- Index regeneration integrated (was in build-orchestrator.js)
- Token auth via http.extraHeader (was in remote URL, leaked in logs)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add comment: orphan path is a bootstrap safety net
- Add comment: branch cleanup catches all stale branches via ls-remote

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci openshift-ci Bot removed the lgtm label Apr 24, 2026
@openshift-ci

openshift-ci Bot commented Apr 24, 2026

Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

Keep the original CLI style: deploy-gh-pages.sh <publish_dir> [--message <msg>]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
themr0c and others added 2 commits April 24, 2026 17:25
Branch cleanup now fetches all remote heads in a single call instead of
one ls-remote per directory. Also adds cross-reference to orchestrator's
getReleaseNotesLink() for maintainability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The gh-pages branch has existed for years; the orphan creation path
was unreachable code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SonarCloud S7682 flags implicit returns in bash functions as unclear
intent. Adding explicit return 0 to all five flagged functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@themr0c themr0c requested review from nickboldt and rh-tokeefe April 24, 2026 15:34
@themr0c themr0c merged commit af9329d into redhat-developer:main Apr 27, 2026
8 of 9 checks passed
@themr0c themr0c deleted the fix/gh-pages-workflow branch April 29, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants